<?php
declare(strict_types=1);
namespace Field;

class SysRoleAuthConst
{
    public const pk='';
    public const index=[];
	public const fields=['RoleID','Node','Status'];
	public const comment=['RoleID'=>'','Node'=>'菜单ID','Status'=>''];
	/*
    * @Field RoleID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const RoleID = 'RoleID';
    /*
    * @Field Node
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null NO
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 菜单ID
    */
    public const Node = 'Node';
    /*
    * @Field Status
    * @Type int(11)
    * @Collation 
    * @Null NO
    * @Key 
    * @Default 1
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const Status = 'Status';
}

class SysRoleAuthColumns
{
public  int $RoleID;
   public  string $Node;
   public  int $Status;
	public function toArray():array
	{
		return [
'RoleID'=>$this->RoleID,
    'Node'=>$this->Node,
    'Status'=>$this->Status,        ];
	}
}

class SysRoleAuthRow
{
	public SysRoleAuthColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'RoleID' => $this->data->RoleID,
        'Node' => $this->data->Node,
        'Status' => $this->data->Status, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysRoleAuthColumns();
        isset($data['RoleID']) && $this->data->RoleID = (int)$data['RoleID'];
           isset($data['Node']) && $this->data->Node = (string)$data['Node'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
    }
}
?>